import { BaseClient } from '../framework/BaseClient';
import { EClientType } from '../../common/EClientType';
import { EClientState } from '../framework/common/EClientState';
import { EMessageS2C } from '../../common/EMessageS2C';

export class DebugClient extends BaseClient {

    public tag: string = 'DebugClient';

    public name: string;

    public pair: DebugClient;

    public get isInPair(): boolean {
        return this.pair != null;
    }

    public type: EClientType = EClientType.Undefine;

    public CheckPairAlive() {
        if (this.type != EClientType.Debugger) return;
        if (!this.isInPair) return;
        if (this.pair.state == EClientState.Closed) {
            this.SendMsg(EMessageS2C.ClientDisconnect);
            this.pair = null;
        }
    }

}